home *** CD-ROM | disk | FTP | other *** search
/ Aminet 22 / Aminet 22 (1997)(GTI - Schatztruhe)[!][Dec 1997].iso / Aminet / dev / src / ConfigFileSrc.lha / ConfigFileSrc12 / RexxLibrary / Funcs / Find.c < prev    next >
Encoding:
Text File  |  1997-10-02  |  2.9 KB  |  126 lines

  1. /*
  2. **        $PROJECT: RexxConfigFile.library
  3. **        $FILE: Find.c
  4. **        $DESCRIPTION: rxcf_Find#?() functions
  5. **
  6. **        (C) Copyright 1997 Marcel Karas
  7. **             All Rights Reserved.
  8. */
  9.  
  10. IMPORT struct Library *CFBase;
  11.  
  12. /****** rexxconfigfile.library/cf_FindArgument *******************************
  13. *
  14. *   NAME
  15. *        cf_FindArgument -- Finds a specfic argument node. (case sensitive)
  16. *
  17. *   SYNOPSIS
  18. *        ArgNode = cf_FindArgument(GrpNode,Name)
  19. *
  20. *        ARGNODE/N cf_FindArgument(GRPNODE/N/A,NAME/A)
  21. *
  22. *   FUNCTION
  23. *        This function finds a specfic argument node.
  24. *
  25. *   INPUTS
  26. *        GrpNode - The group node of the argument list to search.
  27. *        Name - Name of the argument node. 
  28. *
  29. *   RESULT
  30. *        ArgNode - The argument node or NULL.
  31. *
  32. *   SEE ALSO
  33. *        cf_FindGroup(), cf_FindItem()
  34. *
  35. ******************************************************************************
  36. *
  37. */
  38.  
  39. UWORD rxcf_FindArgument ( RX_FUNC_ARGS, CFGroup * GrpNode )
  40. {
  41.     CFArgument * ArgNode;
  42.  
  43.     if ( ArgNode = cf_FindArgument (GrpNode, RXARG2) )
  44.         *ResStr = CreateNumArgStrP (ArgNode);
  45.     return (RC_OK);
  46. }
  47.  
  48. /****** rexxconfigfile.library/cf_FindGroup **********************************
  49. *
  50. *   NAME
  51. *        cf_FindGroup -- Finds a specfic group node. (case sensitive)
  52. *
  53. *   SYNOPSIS
  54. *        GrpNode = cf_FindGroup(Header,Name)
  55. *
  56. *        GRPNODE/N cf_FindGroup(HEADER/N/A,NAME/A)
  57. *
  58. *   FUNCTION
  59. *        This function finds a specfic group node.
  60. *
  61. *   INPUTS
  62. *        Header - A pointer to the Header of the group list to search.
  63. *        Name - Name of the group node.
  64. *
  65. *   RESULT
  66. *        GrpNode - The group node or NULL.
  67. *
  68. *   SEE ALSO
  69. *        cf_FindArgument(), cf_FindItem()
  70. *
  71. ******************************************************************************
  72. *
  73. */
  74.  
  75. UWORD rxcf_FindGroup ( RX_FUNC_ARGS, CFHeader * Header )
  76. {
  77.     CFGroup    * GrpNode;
  78.  
  79.     if ( GrpNode = cf_FindGroup (Header, RXARG2) )
  80.         *ResStr = CreateNumArgStrP (GrpNode);
  81.     return (RC_OK);
  82. }
  83.  
  84. /****** rexxconfigfile.library/cf_FindItem ***********************************
  85. *
  86. *   NAME
  87. *        cf_FindItem -- Finds a specfic item node.
  88. *
  89. *   SYNOPSIS
  90. *        ItemNode = cf_FindItem(ArgNode,Contents,Type)
  91. *
  92. *        ITEMNODE/A cf_FindItem(ARGNODE/N/A,CONTENTS/A,TYPE/A)
  93. *
  94. *   FUNCTION
  95. *        This function finds a specfic item node.
  96. *
  97. *   INPUTS
  98. *        ArgNode - The argument node of the item list to search.
  99. *        Contents - Contents of the item node.
  100. *        Type - The type of contents (see cf_NewItem()).
  101. *
  102. *   RESULT
  103. *        ItemNode - The item node or NULL.
  104. *
  105. *   SEE ALSO
  106. *        cf_FindArgument(), cf_FindGroup(), cf_NewItem()
  107. *
  108. ******************************************************************************
  109. *
  110. */
  111.  
  112. UWORD rxcf_FindItem ( RX_FUNC_ARGS, CFArgument * ArgNode )
  113. {
  114.     RXCFItemConv  ItemConv;
  115.     CFItem        * ItemNode;
  116.  
  117.     if ( ConvItemStrings (RxMsg, &ItemConv, 2, 3, 0) )
  118.     {
  119.         if ( ItemNode = cf_FindItem (ArgNode, ItemConv.Contents, ItemConv.Type) )
  120.             *ResStr = CreateNumArgStrP (ItemNode);
  121.         return (RC_OK);
  122.     }
  123.  
  124.     return (RXERR_INVALID_ARG);
  125. }
  126.